<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>{{ user.name }}</title>
</head>

<body>

<div id="wrap">
    <h1>Welcome {{ user.name }}</h1>
    <p>A list of your exams...</p>
    
    {% if exams %}
        <ul>
        {% for exam in exams %}
            <li>
                {{  exam.remarks }}
                <a href="/exams/user/{{ user.id }}/stats/{{ exam.id }}">Statistics</a>
                <a href="/exams/user/{{ user.id }}/show/{{ exam.id }}">View exam</a>
            </li>
        {% endfor %}
        </ul>
        <p>You have completed {{ count }} exams and your average grade is {{ average }}</p>
    {% else %}
        {% if user.role_id == 2 %}
            <P>You have not taken any exams. Check out the <a href="#">list</a> of available exams </P>
        {% endif %}
        {% if user.role_id == 1 %}
            <P>You have not created any exams. <a href="#">Create new exam</a></P>
        {%  endif %}
    {% endif %}
    <ul>
        {% for x in exam.all %}
        <li>
            <p>{{ exam.course }}</p>
            <p>{{ exam.type }}</p>
            <p>Mark: {{ exam.remark }}</p>
            <a href="#">Skoða nánar</a>
        </li>
        {% endfor %}
{#        <li>#}
{#            <p>Forritun I</p>#}
{#            <p>Skyndipróf @ 02.02.12</p>#}
{#            <p>Einkunn : 7,1</p>#}
{#            <a href="#">Skoða nánar</a></li>#}
    </ul>
</div>

</body>
</html>